angular.module('brandset', [])
.controller('brandsetCtrl', ['$scope', 'httpService', '$rootScope', '$state', function($scope, httpService, $rootScope, $state) {
    
  // 获取部门
  $scope.getRoles = function(page) {
    if(!page) { page = 1 }
    if(!!$rootScope.user) {
      httpService.query('web/companies/' + $rootScope.user.company_id + '/fetch_department_roles', { page: page, limit: limit}).then(function(res) {
        if(res.code == 200) {
          $scope.departments = res.departments;
          $scope.page = res.page
        }
      });
    }
  }
  $scope.getRoles();

  // 修改department
  $scope.updateDepartment = function(department) {
    $state.go('mine.brandadd', { department: JSON.stringify(department)})
  };
  
}]);